var mongoose = require("mongoose");
var Schema = mongoose.Schema;

const UserSchema = new Schema(
  {
    name: {
      type: String,
      default: Math.random().toString(36).substr(2),
    },
    password: {
      type: String,
      required: true,
    },
    username: {
      type: String,
    },
    QQ: {
      type: Number,
    },
    sex: {
      type: String,
      default: "-",
    },
    money: {
      type: Number,
      default: 0,
    },
    audits: {
      type: Boolean,
      default: false,
    },
    phone: {
      type: String,
      default: "",
    },
    rent_time: {
      type: Number,
      default: 0,
    },
    introduce: {
      type: String,
      default: "",
    },
    avatar: {
      type: String,
      default: "static/img/user/logo.jpg",
    },
    date: {
      type: Date,
      default: Date.now(),
    },
    grade: {
      type: Number,
      default: 0,
    },
  },
  {
    versionKey: false,
  }
);
module.exports = User = mongoose.model("users", UserSchema);
